package com.example.chao.myphotosearch.Listener;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.example.chao.myphotosearch.dao.RecommendContent;
import com.example.chao.myphotosearch.view.activities.SearchActivity;

/**
 * Created by chao on 2016/5/10.
 */
public class StartSearchActivityListener implements View.OnClickListener {
    private RecommendContent content;

    public StartSearchActivityListener(RecommendContent content) {
        this.content = content;
    }

    @Override
    public void onClick(View v) {
        if (content == null) {
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putString("title", content.getTitle());
        bundle.putString("bg_img", content.getImgUrl());
        Intent intent = new Intent();
        intent.putExtra("search", bundle);
        intent.setClass(v.getContext(), SearchActivity.class);
        v.getContext().startActivity(intent);
    }
}
